<?php
namespace app\shop31\model;
use think\Model;
class Brand  extends Model
{

    public function searchKeywordsAttr($q,$v)
    {
        $q->where('brand_name','like',"%{$v}%");
    }

    public function searchTuijianAttr($q,$v)
    {
        $q->where('recommended','=',$v);
    }

    public function searchYoutuAttr($q,$v)
    {
        $q->where('brand_logo','=',"{$v}");
    }

    public function searchXianshiAttr($q,$v)
    {
        $q->where('if_show','=',"{$v}");
    }

    public function searchQuanbuAttr($q,$v)
    {
        $q->where('brand_id','>',$v);
    }
    public static function getBrand($where,$param)
    {
        $sql=Brand::withSearch(array_keys($where),$where)
            ->order('sort_order')
            ->paginate([
                'list_rows'=>5,
                'query' => $where

            ]);
        return $sql;
    }
}